package cn.cxj.user.controller;

import cn.cxj.basic.util.LoginContext;
import cn.cxj.user.domain.UserAddress;
import cn.cxj.user.service.IUserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/userAddress")
public class UserAddressController {

    @Autowired
    private IUserAddressService userAddressService;

    /**
     * 基于用户的id查询用户的全部收获地址
     * @param request
     * @return
     */
    @GetMapping
    public List<UserAddress> getByUserId(HttpServletRequest request){
        List<UserAddress> list = userAddressService.queryByUserId(LoginContext.getCurrentLogininfo(request));
        return list;
    }
}
